//
// Created by Administrator on 2023/8/6.
//
#include <iostream>
#include <string>
#include <unordered_map>

using namespace std;

class Solution {
public:
    bool digitCount(string num) {
        unordered_map<int, int> counter;
        for (auto &x: num) counter[x - '0']++;
        for (int i = 0; i < num.size(); ++i) {
            if (counter[i] != num[i] - '0') return false;
        }
        return true;
    }
};


int main() {
    Solution s;
    cout << s.digitCount("1210") << endl;
    return 0;
}